Chapter 8. Stabilizer Code and Surface Code
In Chapter 7, we saw methods to manually design logical \(|0\rangle_L\) and \(|1\rangle_L\) states, such as in the 3-qubit code or the 9-qubit Shor code. However, this is a very clever but ad-hoc approach. To handle millions of qubits, we need a general mathematical framework that allows us to systematically design, analyze, and classify codes.
That is exactly the Stabilizer Formalism. This powerful theory defines the ‘code space’ as a space “stabilized by specific operators,” and it clearly explains the error detection principle through commutation/anticommutation relations.
In this chapter, we will learn this stabilizer formalism and examine how the Surface Code, currently the most promising candidate for quantum computer architecture, operates within this formalism.
1. Fundamental Concepts
Pauli Group (\(G_n\)): The ‘alphabet’ of all \(X, Y, Z\) errors that can act on an \(n\)-qubit system. It refers to the set of \(n\)-qubit Pauli operators (including \(\pm 1, \pm i\) phases).
Stabilizer Group (\(S\)): A set of ‘measurement tools’ defining the code space. \(S\) is a subgroup of the Pauli group \(G_n\), and satisfies the following two conditions:
- Abelian: All operators \(M_i, M_j\) in \(S\) commute with each other. (\([M_i, M_j] = 0\))
- Non-triviality: Does not include \(-I\) (global phase -1).
Code Space (\(V_S\)): A subspace consisting of state vectors that have eigenvalue +1 for all operators \(M\) in the stabilizer group \(S\). In other words, the space ‘stabilized’ by \(S\). \[V_S = \{ |\psi\rangle \mid M |\psi\rangle = (+1) |\psi\rangle \quad \forall M \in S \}\] This \(V_S\) is precisely the error-protected space where our ‘logical 0’ and ‘logical 1’ reside.
Stabilizer Generators: Instead of dealing with the entire large group \(S\), it suffices to have a minimal set of independent operators \(\langle M_1, M_2, \dots, M_g \rangle\) that generate \(S\).
- The \(M_1 = Z_1 Z_2, M_2 = Z_2 Z_3\) learned in Chapter 7 were the ‘generators’ of the 3-qubit code.
Error Detection: The core of the stabilizer formalism.
Some error \(E\) has occurred, resulting in the state \(|\psi'\rangle = E |\psi\rangle_L\).
Measure the stabilizer \(M_i\).
If \(E\) commutes with \(M_i\) (\(EM_i = M_i E\)): \(M_i |\psi'\rangle = M_i E |\psi\rangle_L = E M_i |\psi\rangle_L = E (+1) |\psi\rangle_L = +|\psi'\rangle\). (eigenvalue +1, error detection failed)
If \(E\) anti-commutes with \(M_i\) (\(EM_i = -M_i E\)): \(M_i |\psi'\rangle = M_i E |\psi\rangle_L = -E M_i |\psi\rangle_L = -E (+1) |\psi\rangle_L = -|\psi'\rangle\). (eigenvalue -1, error detection success!)
Conclusion: The error \(E\) must anti-commute with at least one stabilizer generator to be detected.
Code Parameters \([[n, k, d]]\): The code is classified by three numbers.
- \(n\): Total number of physical qubits.
- \(k\): Number of encoded logical qubits. (\(k = n - g\), \(g\) is the number of generators)
- \(d\): Code Distance. The weight (i.e., number of qubits acted upon) of the smallest logical operator that is undetectable/uncorrectable (i.e., commutes with all stabilizers). When \(d=2t+1\), \(t\) errors can be corrected.
Surface Code: The most practical example of a stabilizer code. Place qubits on a 2D grid and create stabilizer generators using only nearest neighbor (local) qubits.
- Advantages: 1) Easy to implement on real chips (2D), 2) Only local operations are needed for error detection, 3) If the error rate is below a certain threshold, increasing the code size exponentially reduces the logical error rate. 🏆
2. Symbols and Key Relations
- Pauli Group (Generators): \(G_n = \langle X_1, \dots, X_n, Z_1, \dots, Z_n \rangle\) (excluding identity)
- Stabilizer Group (Generators): \(S = \langle M_1, \dots, M_g \rangle\) (where \(g=n-k\))
- Code Space (\(V_S\)): \(M_i |\psi\rangle_L = |\psi\rangle_L\)
- Error Detection Condition: \(E \in G_n\). \([E, M_i] \neq 0\) (i.e., anti-commute)
- Error Non-Detection Condition (Logical Error): \(E \in C(S) \setminus S\).
- \(C(S)\) is the set of all operators that commute with \(S\) (Centralizer).
- \(C(S) \setminus S\) refers to operators \(E\) that commute with all stabilizers (\([E, M_i]=0\)) but are not elements of the stabilizer group itself (\(E \notin S\)). These are exactly the logical operators (\(\bar{X}, \bar{Z}\)).
- Distance \(d\): \(d = \min \{ \text{weight}(E) \mid E \in C(S) \setminus S \}\)
3. Easy Examples (Examples with Deeper Insight)
Example 1: 3-Qubit Bit Flip Code (Chapter 7 Review)
- Parameters: \(n=3\) physical qubits.
- Generators: (Total \(g=2\))
- \(M_1 = Z_1 Z_2 \otimes I_3\)
- \(M_2 = I_1 \otimes Z_2 Z_3\)
- Number of Logical Qubits \(k\): \(k = n - g = 3 - 2 = 1\) qubit.
- Code Space \(V_S\): \(Z_1 Z_2 |\psi\rangle = |\psi\rangle\) and \(Z_2 Z_3 |\psi\rangle = |\psi\rangle\) must be satisfied.
- \(|000\rangle\): \((+1)|000\rangle, (+1)|000\rangle\). (OK)
- \(|111\rangle\): \((+1)|111\rangle, (+1)|111\rangle\). (OK)
- \(|100\rangle\): \(Z_1 Z_2 |100\rangle = (-1)|100\rangle\). (Excluded)
- Code space \(V_S = \text{span}\{ |000\rangle, |111\rangle \}\). Matches exactly with \(|0\rangle_L, |1\rangle_L\) in Chapter 7.
- Error Detection: \(E = X_1\) (bit flip on the first qubit)
- \([M_1, E]\)? \(\to [Z_1 Z_2, X_1] = Z_1[Z_2, X_1] + [Z_1, X_1]Z_2 = 0 + (-2Z_1 X_1)Z_2 \neq 0\). (Anticommutator)
- \([M_2, E]\)? \(\to [Z_2 Z_3, X_1] = 0\). (Commutator)
- Syndrome: \(M_1\) is -1, \(M_2\) is +1. Same as the (1, 0) syndrome in Chapter 7.
- Generators: (Total \(g=2\))
Example 2: 5-qubit “Perfect” Code \([[5, 1, 3]]\)
Parameters: \(n=5\), \(g=4\) \(\implies k=1\).
Generators: \(M_1=XZZXI, M_2=IXZZX, M_3=XIXZZ, M_4=ZIXIXZ\) (cyclic)
Distance \(d\):
- Logical Z: \(\bar{Z} = ZZZZZ\). (Commutates with all \(M_i\), weight=5)
- Logical X: \(\bar{X} = XXXXX\). (Commutates with all \(M_i\), weight=5)
💡 Detailed Explanation (10 Errors, 10 Syndromes)
This code can correct 1-qubit errors (\(d=3 \to t=1\)).
- Single-qubit errors are \(X_1, Y_1, Z_1, \dots, Z_5\), totaling \(3 \times n = 15\).
- \(g=4\) generators can produce \(2^4 = 16\) syndrome combinations. (No error (1) + errors (15))
- \(E=X_1\) \(\to\) Anticommutator with \(M_1, M_4\) \(\to\) Syndrome (1,0,0,1)
- \(E=Z_1\) \(\to\) Anticommutator with \(M_2, M_3\) \(\to\) Syndrome (0,1,1,0)
- \(E=Y_1\) \(\to\) Anticommutator with \(M_1, M_2, M_3, M_4\) \(\to\) Syndrome (1,1,1,1)
All 15 single-qubit errors produce 15 different unique syndromes. Therefore, by looking at the syndrome alone, you can accurately diagnose “Ah, there was a Y error on qubit 1” and recover with \(Y_1^\dagger\). Since 15 errors are perfectly distinguished by 15 symptoms, it is called a ‘perfect’ code.
Example 3: Surface Code - [[9, 1, 3]] (Simplified)
Scenario: Place qubits on a \(3 \times 3\) grid. (Actually, \(n=13\) qubit \([[13, 1, 3]]\) is more standard, but \(n=9\) is used for conceptual explanation)
Qubits: Place 9 qubits at nodes (1-9)
Stabilizer Generators (\(g=n-k=9-1=8\)):
Face (Plaquette) Stabilizer (\(Z\)): 4 faces. \(M_1=Z_1 Z_2 Z_4 Z_5\), \(M_2=Z_2 Z_3 Z_5 Z_6\), …
Vertex Stabilizer (\(X\)): 4 internal vertices. \(M_5=X_1 X_2 X_4 X_5\) … (faces and vertices can be defined differently. Here, the toric code is simplified)
💡 Detailed Explanation (Error Detection: Anyons)
- No error: All faces (\(Z\)) and vertices (\(X\)) have eigenvalues +1. “Vacuum state”.
- \(X_5\) error occurs (an \(X\) error on the 5th qubit in the center):
- \(X_5\) commutes with the \(X\) stabilizer (vertex). (\([X_5, X_i X_j X_k X_5] = 0\))
- \(X_5\) anticommutes with the \(Z\) stabilizer (face).
- \(X_5\) belongs to all 4 faces (\(M_1, M_2, M_3, M_4\)).
- Syndrome: The eigenvalues of \(M_1, M_2, M_3, M_4\) all change to -1! Four faces have ‘defects’ (anyons).
- \(Z_5\) error occurs:
- \(Z_5\) commutes with the \(Z\) stabilizer.
- \(Z_5\) anticommutes with the \(X\) stabilizer that includes itself.
- Syndrome: Four vertices (\(X\) stabilizers) have defects.
- Error Chain (Error Chain): \(E = Z_4 Z_5\) (a \(Z\) error on qubits 4 and 5)
- \(Z_4 Z_5\) commutes with \(X_1 X_2 X_4 X_5\) (includes 4, 5) and \(X_4 X_5 X_7 X_8\) (includes 4, 5) (Z meets X twice)
- \(Z_4 Z_5\) anticommutes with \(X\) stabilizers \(X_1 X_4 X_2 X_5\) and \(X_2 X_3 X_5 X_6\)…
- (Correction) The \(Z_4 Z_5\) error only changes the stabilizers at the endpoints of the error chain (-1), while the stabilizers in the middle commute with Z twice (+1).
- Syndrome: We do not see the error itself (\(Z_4, Z_5\)), but only the two ‘defects’ that appear at the endpoints of the error chain.
- Logical error: \(E = Z_1 Z_4 Z_7\) (a \(Z\) error chain connecting 1-4-7)
- This chain connects one end of the lattice to the opposite end. Since the ‘endpoints’ are outside the lattice, it commutes with all internal \(X\) stabilizers.
- The syndrome is (0, 0, …, 0). The error is not detected.
- This is exactly the \(\bar{Z}\) logical operator. The code distance \(d\) is the length of the shortest logical operator (in this case 3). \(\implies [[9, 1, 3]]\) code.
4. Practice Problems
- \([n, k, d]\) parameters: What are the stabilizer generators of the 3-qubit phase flip code (\(|+++\rangle, |---\rangle\)) in Chapter 7, and what are the \([[n, k, d]]\) parameters?
- Stabilizer commutation: Check whether \(M_1=XZZXI\) and \(M_2=IXZZX\) of the 5-qubit code commute with each other (\([M_1, M_2]=0\)). (Hint: \(XZ = -ZX, ZZ=I, XX=I\))
- Distance: The 9-qubit Shor code (\([[9, 1, 3]]\)) can correct \(t\) number of errors. What is \(t\)?
- Surface Code Syndrome: In the \(3 \times 3\) surface code (Example 3), an \(X_2\) error (X error on the 2nd qubit) has occurred. Predict which type of stabilizer (X or Z) and how many will have -1 eigenvalues.
5. Explanation
- In Example 2 of Chapter 7, the phase flip code measured syndromes using \(X_1 X_2\) and \(X_2 X_3\).
- Generators: \(M_1 = X_1 X_2\), \(M_2 = X_2 X_3\).
- \(n=3, g=2 \implies k=n-g=1\).
- Logical operators: \(\bar{Z} = Z_1 Z_2 Z_3\), \(\bar{X} = X_1 X_2 X_3\) (or \(X_1\)). ( \(\bar{X}=X_1 X_2 X_3\), \([ \bar{X}, M_1] = [X_1 X_2 X_3, X_1 X_2] = X_3(X_1 X_2)(X_1 X_2) = X_3 \neq 0\). Correction: \(\bar{X} = X_1 X_2 X_3\) is incorrect. \(\bar{X} = X_1\).
- Logical operators \(\bar{X} = X_1 X_2 X_3\), \(\bar{Z} = Z_1 Z_2 Z_3\). ( \(X\) operators commute with each other, \(Z\) operators commute with each other) Correction: \(\bar{Z} = Z_1 Z_2 Z_3\), \(\bar{X} = X_1\). \([\bar{X}, M_1] = [X_1, X_1 X_2] = 0\). \([\bar{X}, M_2] = [X_1, X_2 X_3] \neq 0\).
- Revised correction: \(\bar{X} = X_1 X_2 X_3\), \(\bar{Z} = Z_1 Z_2 Z_3\). (Bit flip code: \(\bar{Z}=Z_1 Z_2 Z_3, \bar{X}=X_1 X_2 X_3, d=3\). Phase flip code: \(\bar{Z}=Z_1 Z_2 Z_3, \bar{X}=X_1 X_2 X_3, d=3\).)
- The parameters are \([[3, 1, 3]]\). (Both codes)
- \([M_1, M_2] = [XZZXI, IXZZX]\). The overlapping qubits are the 2nd, 3rd, and 4th qubits.
- 2nd qubit: \([Z, X] \neq 0\) (anti-commute)
- 3rd qubit: \([Z, Z] = 0\) (commute)
- 4th qubit: \([X, Z] \neq 0\) (anti-commute)
- Since there are 2 anti-commutations (even), \(M_1 M_2 = (-1)^2 M_2 M_1 = M_2 M_1\). Therefore, \([M_1, M_2]=0\) (commute).
- \(d = 2t+1\). \(3 = 2t+1 \implies 2t=2 \implies t=1\). The 9-qubit Shor code can correct 1 arbitrary single-qubit error.
- The \(X_2\) error is an \(X\)-type error.
- An \(X\) error anti-commutes with \(Z\) stabilizers and commutes with \(X\) stabilizers.
- The plaquette stabilizers (\(Z\)-type) that include the 2nd qubit are \(M_1=Z_1 Z_2 Z_4 Z_5\) and \(M_2=Z_2 Z_3 Z_5 Z_6\).
- Therefore, \(M_1\) and \(M_2\) will have -1 eigenvalues. (Total of 2 Z-stabilizers)